using System;
using System.Text.Json.Serialization;

namespace JT808Protocol.Models.BodyParserStrategy.Location.LocationAddition
{
    /// <summary>
    /// BYTE，无线通信网络信号强度
    /// </summary>
    public class LaNetworkSignalStrength_0x30 : ILocationAddition
    {
        /// <summary>
        /// 无线通信网络信号强度
        /// </summary>
        [JsonPropertyName("无线通信网络信号强度")] public byte NetworkSignalStrength { get; set; }

        public override ILocationAddition ReadEntity(ReadOnlySpan<byte> source, int startIndex)
        {
            DataLength = (byte)(source[startIndex + 1] + 2);
            if (DataLength != 2 + 1)
            {
                //Logger.Warn($"位置附加信息的 无线通信网络信号强度 信息长度错误，略过解析");
                return null;
            }
            NetworkSignalStrength = source[startIndex + 2];

            return this;
        }
    }
}